package cn.edu.hyit.zhao.intecepter;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.StrutsStatics;


import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

import cn.edu.hyit.zhao.utils.LogUtils;

/**
 * 资源请求拦截器，将每次对系统的访问写入到日志中
 * 
 * @author Neko
 * @version 1.0
 * @date 2016-01-04
 */
@SuppressWarnings("serial")
public class RequestIIntercept extends AbstractInterceptor {

	@Override
	public String intercept(ActionInvocation ai) throws Exception {
		HttpServletRequest request = (HttpServletRequest) ai
				.getInvocationContext().get(StrutsStatics.HTTP_REQUEST);
		LogUtils.saveLog(request, null);
		return ai.invoke();
	}

}
